package org.jfteam.common.response;

import java.util.LinkedHashMap;

/**
 * Created with IntelliJ IDEA.
 * Description: 描述
 * Author:      fengwenping
 * Date:        2021/3/28 16:43
 */
public class ResponseVO extends LinkedHashMap<String, Object> {

    ResponseVO() {
        this.setResponseCode(ResponseState.SUCCESS.getCode());
        this.setResponseCode(ResponseState.SUCCESS.getMsg());
    }

    ResponseVO(String responseCode) {
        this.setResponseCode(responseCode);
    }

    ResponseVO(String responseCode, String responseMsg) {
        this.setResponseCode(responseCode);
        this.setResponseMsg(responseMsg);
    }

    public ResponseVO setResponseCode(String responseCode) {
        this.put("responseCode", responseCode);
        return this;
    }

    public ResponseVO setResponseMsg(String responseMsg) {
        this.put("responseMsg", responseMsg);
        return this;
    }

    public ResponseVO setData(Object data) {
        this.put("data", data);
        return this;
    }

    public ResponseVO addData(String key, Object value) {
        this.put(key, value);
        return this;
    }

    public String getResponseCode() {
        return (String) this.get("responseCode");
    }

    public String getResponseMsg() {
        return (String) this.get("responseMsg");
    }

    public Object getData() {
        return this.get("data");
    }
}
